package com.bop.dehong.http.model;

import java.lang.reflect.Type;

import android.app.Activity;

import com.base.dehong.http.HttpRequest;
import com.base.dehong.http.RequestCallBack;
import com.base.dehong.util.MD5Util;
import com.bop.dehong.config.Config;
import com.bop.dehong.info.LoginInfo;
import com.google.gson.reflect.TypeToken;
/**
 * 登录
 * @author TangWenhan/YeFengYun
 *
 */
public class LoginModel extends HttpRequest<LoginInfo>{

	public LoginModel(Activity activity, RequestCallBack<LoginInfo> callback) {
		super(activity, callback);
	}

	@Override
	public String getURL() {
		return Config.getIP() + Config.getLoginUrl();
	}
	public void doNet(String username,String password, String device_code) {
		mPostValues.put("a", "loging");
		mPostValues.put("m", "Passport");
		mPostValues.put("password", MD5Util.getMD5String(password));//密码md5加密
		mPostValues.put("device_code", device_code);
		mPostValues.put("username", username);
		requestByPost();
	}
	
	public Type getType(){
		return new TypeToken<LoginInfo>() {}.getType();
	}

	@Override
	public Class<LoginInfo> getClazz()
	{
		return LoginInfo.class;
	}

}
